import java.util.Random;


public class OfRandomSet2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		int length = 100;//数据库中的总数据条数
		int array[] = new int[length];
		for (int i=0; i<length; i++) {
			array[i] = i+1;
		}
		int ar[] = new int[12];//每套试卷12道题
		
		Random rand = new Random();
		
		for (int i=0; i<ar.length; i++) {
			int a = rand.nextInt(length-i); //范围[0,)
			ar[i] = array[a];
			OfRandomSet2.swap(array, length-i-1, a);
		}
		for (int a : ar) {
			System.out.print(a + ",  ");
		}
	}
	
	public static void swap(int[] array, int i, int j) {
		int temp = 0;
		temp = array[i];
		array[i] = array[j];
		array[j] = temp;
	}

}
